<?php
class Myblog_Form_CategoryCreate extends Zend_Form
{
public $formDecorators=array(
array('FormElements'),
array('Form'),
);
public $elementDecorators=array(
array('ViewHelper'),
array('Label'),
array('Errors'),
array('HtmlTag',array('dd'=>'p','id'=>'title')),
);
public $buttonDecorators=array(
array('ViewHelper'),
array('HtmlTag',array('tag'=>'p'))
);

	public function init()
	{
	$this->setAction('/admin/category/create')
		->setMethod('post')
		->setName('categorycreate')
		->setDecorators($this->formDecorators);

	$cat_name=new Zend_Form_Element_Text('category_name');
	$cat_name->setLabel('Название категории:')
		->setOptions(array('size'=>'15'))
		->setRequired(true)
		->addValidator('NotEmpty')
		->addFilter('HtmlEntities')
		->addFilter('StringTrim')
		->addFilter('StringToLower')
		->addValidator('Regex',false,array('pattern'=>'/^[a-z]+$/'))
		->setDecorators($this->elementDecorators);

	$id=new Zend_Form_Element_Text('category_id');
	$id->setLabel('ID категории:')
		->setOptions(array('size'=>'8','placeholder'=>'autoincrement'))
		->addValidator('Int')
		->setDecorators($this->elementDecorators);

	$submit=new Zend_Form_Element_Submit('submit');
	$submit->setLabel('Создать')
		->setDecorators($this->buttonDecorators);

	$this->addElements(array($cat_name,$id,$submit));
	}

}
